<?php

$con = mysql_connect ("localhost" , "root" , "root");
if(!$con)
{
	die ('could not connect: ' . mysql_error());
}
mysql_select_db("ncrdforg_ncrdf",$con);
$var = mysql_query ("select id from questions where question = 'Why People Smoke? What are its causes?' ");
$id = 0; 
while($r = mysql_fetch_array($var))
{
		$id = $r[0];
}
$answer = $_POST["comment"];
$var2 = mysql_query ("insert into answers values ('$id', '$answer') ");

header('Location: forums.php');
?>